package com.bf.electroplating.controller.front;

import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.predischarge.PreDischargeMonitoringDataVO;
import com.bf.electroplating.service.IFrontPreDischargeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 前端预排口监测数据控制器
 * 提供企业预排口监测相关的数据接口
 */
@RestController
@RequestMapping("/api/front/predischarge")
@Tag(name = "前端预排口监测", description = "前端预排口监测相关接口")
public class FrontPreDischargeController {

    @Autowired
    private IFrontPreDischargeService frontPreDischargeService;

    /**
     * 获取预排口监测数据
     * 提供所有企业的预排口监测数据，包括企业列表、运行数据、历史趋势等
     */
    @GetMapping("/monitoring-data")
    @Operation(summary = "获取预排口监测数据", description = "获取所有企业的预排口监测数据，包括企业列表、运行数据、历史趋势等")
    public ResultVO<PreDischargeMonitoringDataVO> getPreDischargeMonitoringData() {
        PreDischargeMonitoringDataVO data = frontPreDischargeService.getPreDischargeMonitoringData();
        return ResultVO.ok(data);
    }

    /**
     * 根据企业ID获取预排口监测数据
     * 提供指定企业的预排口监测数据
     */
    @GetMapping("/monitoring-data-by-company")
    @Operation(summary = "根据企业ID获取预排口监测数据", description = "获取指定企业的预排口监测数据")
    public ResultVO<PreDischargeMonitoringDataVO> getPreDischargeMonitoringDataByCompanyId(
            @Parameter(description = "企业ID", required = true)
            @RequestParam String companyId) {
        PreDischargeMonitoringDataVO data = frontPreDischargeService.getPreDischargeMonitoringDataByCompanyId(companyId);
        return ResultVO.ok(data);
    }
}
